<template>
<el-dialog :visible.sync="visible" title="详情" :close-on-click-modal="false" :close-on-press-escape="false" top="70px">
    <el-form :model="dataForm"  ref="dataForm" @keyup.enter.native="dataFormSubmitHandle()" label-width="100px">
        <el-row :gutter="30">
            <el-col :span="12">
                <el-form-item label="项目名称:">
                    <p class="txt">{{ dataForm.title }}</p>
                </el-form-item>
            </el-col>
            <el-col :span="12">
                <el-form-item label="联系电话:">
                    <p class="txt">{{ dataForm.phone }}</p>
                </el-form-item>
            </el-col>
             <el-col :span="12">
                <el-form-item label="开始时间:">
                    <p class="txt">{{ dataForm.startTime }}</p>
                </el-form-item>
            </el-col>
             <el-col :span="12">
                <el-form-item label="结束时间:">
                    <p class="txt">{{ dataForm.endTime }}</p>
                </el-form-item>
            </el-col>
             <el-col :span="24">
                <el-form-item label="封面:">
                    <el-image :src="dataForm.pic" style="width:140px;height:140px"></el-image>
                </el-form-item>
            </el-col>
            <el-col :span="24">
                <el-form-item label="内容:">
                    <p class="txt content" v-html="dataForm.content" style="margin-top:8px"></p>
                </el-form-item>
            </el-col>
        </el-row>
    </el-form>
</el-dialog>
</template>

<script>
import debounce from "lodash/debounce";
export default {
    data() {
        return {
            visible: false,
            dataForm: {
                id: "",
                comments: [],

            },
        };
    },
    methods: {
        init() {
            this.visible = true;
            this.$nextTick(() => {
                this.$refs["dataForm"].resetFields();
                if (this.dataForm.id) {
                    this.getInfo();
                }
            });
        },
        // 获取信息
        getInfo() {
            this.$http
                .get("/scenic/commvolunteer/getOne", {
                    params: {
                        id: this.dataForm.id
                    }
                })
                .then(({
                    data: res
                }) => {
                    if (res.code !== 0) {
                        return this.$message.error(res.msg);
                    }
                    this.dataForm = {
                        ...this.dataForm,
                        ...res.data,
                    };
                })
                .catch(() => {});
        },
    },
};
</script>
<style lang="scss" scoped>
.txt {
    line-height: 40px;
    height: auto;
    margin: 0;
    padding: 0;

    &.content {
        ::v-deep p {
            padding: 0;
            line-height:24px;
            margin:0!important;
        }
        ::v-deep img{
            width:100%;
        }

        img {
            width: 100%;
        }
    }
}
</style>